"""
Copyright 2007, Thomas Dejanovic.

This is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1 of
the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this software; if not, write to the Free
Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
02110-1301 USA, or see the FSF site: http://www.fsf.org.
"""

global hatchBlock

xml1 = """<?xml version="1.0" ?>
    <Struct name="'test_000'" parent="None">
        <target>
            "small apb slave"
        </target>
        <packed>
            True
        </packed>
        <hatch_leaf>
            False
        </hatch_leaf>
        <Register name="'register_a'" parent="'test_000'">
            <comment>
                "This is a register"
            </comment>
            <bit_width>
                32
            </bit_width>
            <default>
                0
            </default>
            <sw>
                "rw"
            </sw>
            <hw>
                "r"
            </hw>
            <hatch_leaf>
                True
            </hatch_leaf>
            <packed>
                True
            </packed>
        </Register>
    </Struct>
    """

xml2 = """<Register name="'register_b'" parent="'test_000'">
        <comment>
            "This is a register"
        </comment>
        <bit_width>
            32
        </bit_width>
        <default>
            0
        </default>
        <sw>
            "rw"
        </sw>
        <hw>
            "r"
        </hw>
        <hatch_leaf>
            True
        </hatch_leaf>
        <packed>
            True
        </packed>
    </Register>
    """

xml3 = """<?xml version="1.0" ?>
    <Struct name="'test_000'" parent="None">
        <target>
            "small apb slave"
        </target>
        <packed>
            True
        </packed>
        <hatch_leaf>
            False
        </hatch_leaf>
        <Register name="'register_a'" parent="'test_000'">
            <comment>
                "This is a register"
            </comment>
            <bit_width>
                32
            </bit_width>
            <default>
                0
            </default>
            <sw>
                "rw"
            </sw>
            <hw>
                "r"
            </hw>
            <hatch_leaf>
                True
            </hatch_leaf>
            <packed>
                True
            </packed>
        </Register>
        <Register name="'register_b'" parent="'test_000'">
            <comment>
                "This is a register"
            </comment>
            <bit_width>
                32
            </bit_width>
            <default>
                0
            </default>
            <sw>
                "rw"
            </sw>
            <hw>
                "r"
            </hw>
            <hatch_leaf>
                True
            </hatch_leaf>
            <packed>
                True
            </packed>
        </Register>
    </Struct>
    """

g = HatchNode('g', xml=xml2)
if True:
    h = HatchNode('h', g, xml=xml1, stringProp='hey!')  # Has other childNodes & properties already.
if False:
    h = HatchNode('h', g, xml=xml3, stringProp='hey!')  # Test: Already has a register_b! Gets BOTH & Property checker should complain.

hatchBlock = h


